import { fileURLToPath, URL } from 'node:url'

import { build, defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'

import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),
  AutoImport({
    resolvers: [ElementPlusResolver()],
  }),
  AutoImport({
    imports: ['vue', 'vue-router']//自动导入vue和vue-router相关api
  }),
  Components({
    resolvers: [ElementPlusResolver()],
  }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    hmr: false,
    proxy: {
      '/school':
      {
        target: "http://43.143.177.23",
        changeOrigin: true
      }
    }
  }
})
